﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
	<meta charset="utf-8" />
	<title>编辑教程</title>
</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->

<body style="padding-top: 70px;">
<jsp:include page="/topNav"></jsp:include>

<div class="container">
    <div class="row">
        <div class="panel panel-default col-md-4 col-md-offset-0 col-sm-8 col-sm-offset-2" style="width: 90%;margin-top: 10px">
            <div role="form" style="width:80%;">
                <h1></h1>

                <label class="control-label" for="title">标题</label>&nbsp;&nbsp;&nbsp;&nbsp;<span id="titlemsg" style="color: #ff0000"></span>
                <div class="required-field-block">
                    <input type="text" id="title"  name="title" placeholder="标题" class="form-control" value="${tutorial.title}"
                           style="margin-bottom: 15px;margin-top: 5px">

                </div>
                <label class="control-label" for="introduction">简介</label>&nbsp;&nbsp;&nbsp;&nbsp;<span id="introductionmsg" style="color: #ff0000"></span>
                <div class="required-field-block">
                    <textarea rows="3" class="form-control" id="introduction" name="introduction" placeholder="文章简介"
                              style="margin-bottom: 15px;margin-top: 5px;height: 100px">${tutorial.introduce}</textarea>
                </div>

                <label class="control-label">类别</label>&nbsp;&nbsp;&nbsp;&nbsp;<span id="categorymsg" style="color: #ff0000"></span>

                <div class="required-field-block">
                    <select id="category" name="category" style="margin-bottom: 15px;margin-top: 5px">
                        <option value="${category.categoryId}">${category.categoryName}</option>
                        <c:forEach var="category" items="${categories}">
                            <option value="${category.categoryId}">${category.categoryName}</option>
                        </c:forEach>
                    </select>

                </div>
                <%--<label class="control-label" for="videourl">视频教程地址(可选)</label>&nbsp;&nbsp;&nbsp;&nbsp;<span id="videomsg"
                                                                                                        style="color: #ff0000"></span>

                <div class="required-field-block">
                    <input type="text" id="videourl" name="videourl" placeholder="视频教程地址" class="form-control"
                           style="margin-bottom: 15px;margin-top: 5px">
                </div>--%>


                <label class="control-label">上传用于文档标题的略缩图(图片大小1M以内,图片名称不能包含中文和特殊字符)</label>&nbsp;&nbsp;&nbsp;&nbsp;
                <span id="saveimgmsg" style="color: #ff0000"></span>
                <div class="required-field-block">
                    <input type="file" id="file_upload_1" />
                </div>
                <button id="btn-upload" type="button" onclick="javascript:$('#file_upload_1').uploadify('upload')" class
                        ="btn btn-success">上传</button>
            </div>
            <table id="imgtable" style="display: none">
                <tr>
                    <td>
                        <img src="" id="titleImg">

                        <p>

                        <form action="thumbnailimage" method="post">
                            <input type="hidden" id="x1" name="x1" />
                            <input type="hidden" id="y1" name="y1" />
                            <input type="hidden" id="w" name="w" />
                            <input type="hidden" id="h" name="h" />
                            <input type="hidden" id="oldpath" name="oldpath" />
                            <input type="hidden" name="username" value="${username}" />
                            <button type="button" onclick="thumbnailimage()" class
                                ="btn btn-success">保存图片
                            </button>
                        &nbsp;&nbsp;&nbsp;&nbsp;
                        <span id="savemsg" style="color: green"></span>
                        </form>
                        </p>
                    </td>
                    <td>
                        <div style="width:96px;height:96px;overflow:hidden;">
                            <img src="" id="preview96">
                        </div>
                        <p>96x96</p>
                    </td>
                    <td>
                        <div style="width:48px;height:48px;overflow:hidden;">
                            <img src="" id="preview48">
                        </div>
                        <p>48x48</p>
                    </td>
                </tr>
            </table>
            <br>
            <p></p>
            <p id="contentmsg" style="color: #ff0000"></p>

            <form action="updateTutorial" method="post" name="updatetutorialform">
                <!-- 加载编辑器的容器 -->
                <script id="uecontainer" name="content" type="text/plain">${tutorial.content}</script>
                <input type="hidden" name="imgsrc" id="imgsrc" value="${tutorial.titleImgPath}"/>
                <input type="hidden" name="titlecontext" id="titlecontext"/>
                <input type="hidden" name="introductioncontext" id="introductioncontext" />
                <input type="hidden" name="video_url" id="video_url" value="" />
                <input type="hidden" name="type" id="type" value="" />
                <input type="hidden" name="tutorialId" id="tutorialId" value="${tutorial.id}" />
                <button type="button" onclick="update(${tutorial.id})" class
                        ="btn btn-success">提交</button>
            </form>
        </div>
    </div>
</div>
</body>
<link href="bootstrap/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="bootstrap/user_defined.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="uploadify/jquery.min.js"></script>
<script type="text/javascript" src="bootstrap/bootstrap.min.js"></script>
<script src="uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="uploadify/uploadify.css">
<link rel="stylesheet" href="jcrop/css/jquery.Jcrop.css">
<script src="jcrop/js/jquery.Jcrop.js"></script>

<!-- 配置文件 -->
<script type="text/javascript" src="ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="ueditor/ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript" src="js/addTutorial.js"></script>
<!-- END BODY -->
</html>
